square = { it * it }
println square(9)

// cannot use "println [ 1, 2, 3, 4 ].collect(square)"
def ret = [ 1, 2, 3, 4 ].collect(square)
println ret

printMapClosure = { key, value -> println key + "=" + value }
myMap = ["key1":"value1","key2":"value2","key3":"value3"]
myMap.each(printMapClosure)

fullString = ""
orderParts = ["BUY", 200, "Hot Dogs", "1"]
orderParts.each {
	fullString += it + " "
}
println fullString	

myMap = ["asdf": 1 , "qwer" : 2, "sdfg" : 10]
result = 0
myMap.keySet().each( { result += myMap[it] } )
println result
